﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace Test1
{
    public partial class Form15_02 : Form
    {
        public Form15_02()
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;
        }
        void Controllight()
        {
            while (true)
            {
                Thread.Sleep(5000);
                pictureBox1.Image = Image.FromFile("Yellow.png");
                Thread.Sleep(2000);
                pictureBox1.Image = Image.FromFile("Red.png");
                Thread.Sleep(8000);
                pictureBox1.Image = Image.FromFile("Green.png");
            }
        }
        private void Form15_02_Load(object sender, EventArgs e)
        {
            Thread th = new Thread(new ThreadStart(Controllight));
            th.Start();
        }
    }
}
